/**
 *PHP V8 Library
 *Copyright(C) Ins<Instance@9.cn> www.narrow-world.com
 */
#ifndef PHP_PHPV8_H
#define PHP_PHPV8_H

extern zend_module_entry phpv8_module_entry;
#define phpext_phpv8_ptr &phpv8_module_entry

#ifdef PHP_WIN32
#	define PHP_PHPV8_API __declspec(dllexport)
#elif defined(__GNUC__) && __GNUC__ >= 4
#	define PHP_PHPV8_API __attribute__ ((visibility("default")))
#else
#	define PHP_PHPV8_API
#endif

extern "C"{
#ifdef ZTS
#include "TSRM.h"
#endif
}

PHP_MINIT_FUNCTION(phpv8);
PHP_MSHUTDOWN_FUNCTION(phpv8);
PHP_RINIT_FUNCTION(phpv8);
PHP_RSHUTDOWN_FUNCTION(phpv8);
PHP_MINFO_FUNCTION(phpv8);

PHP_FUNCTION(phpv8_eval);
PHP_FUNCTION(phpv8_create_context);
PHP_FUNCTION(phpv8_context_eval);
PHP_FUNCTION(phpv8_destroy_context);
/* 
  	Declare any global variables you may need between the BEGIN
	and END macros here:     

ZEND_BEGIN_MODULE_GLOBALS(phpv8)
	long  global_value;
	char *global_string;
ZEND_END_MODULE_GLOBALS(phpv8)
*/

/* In every utility function you add that needs to use variables 
   in php_phpv8_globals, call TSRMLS_FETCH(); after declaring other 
   variables used by that function, or better yet, pass in TSRMLS_CC
   after the last function argument and declare your utility function
   with TSRMLS_DC after the last declared argument.  Always refer to
   the globals in your function as PHPV8_G(variable).  You are 
   encouraged to rename these macros something shorter, see
   examples in any other php module directory.
*/

#ifdef ZTS
#define PHPV8_G(v) TSRMG(phpv8_globals_id, zend_phpv8_globals *, v)
#else
#define PHPV8_G(v) (phpv8_globals.v)
#endif


#endif	/* PHP_PHPV8_H */
